using System.Collections.Generic;
using FixMath;
using UniFramework.Actor;
using UniFramework.Battle;
using UnityEngine;

namespace UniFramework.Aoe
{
	public struct AoeConfig
	{
		public string id;
		public string prefab;
		public bool removeOnObstacle; //aoe是否碰撞到阻挡就摧毁了（removed）
		public string[] tags;
		public FixInt tickTime;
		public AoeOnCreate onCreate;
		public AoeOnTick onTick;
		public AoeOnRemoved onRemoved;
		public AoeOnCharacterEnter onChaEnter;
		public AoeOnCharacterLeave onChaLeave;
		public AoeOnBulletEnter onBulletEnter;
		public AoeOnBulletLeave onBulletLeave;

		public AoeConfig(
			string id, string prefab, string[] tags, FixInt tickTime, bool removeOnObstacle, string onCreate,
			string onRemoved, string onTick, string onChaEnter, string onChaLeave, string onBulletEnter,
			string onBulletLeave
		)
		{
			this.id = id;
			this.prefab = prefab;
			this.tags = tags;
			this.tickTime = tickTime;
			this.removeOnObstacle = removeOnObstacle;
			this.onCreate = string.IsNullOrEmpty(onCreate) ? null : AoeData.onCreateFunc[onCreate];
			this.onRemoved = string.IsNullOrEmpty(onRemoved) ? null : AoeData.onRemovedFunc[onRemoved];
			this.onTick = string.IsNullOrEmpty(onTick) ? null : AoeData.onTickFunc[onTick];
			this.onChaEnter = string.IsNullOrEmpty(onChaEnter) ? null : AoeData.onChaEnterFunc[onChaEnter];
			this.onChaLeave = string.IsNullOrEmpty(onChaLeave) ? null : AoeData.onChaLeaveFunc[onChaLeave];
			this.onBulletEnter = string.IsNullOrEmpty(onBulletEnter) ? null : AoeData.onBulletEnterFunc[onBulletEnter];
			this.onBulletLeave = string.IsNullOrEmpty(onBulletLeave) ? null : AoeData.onBulletLeaveFunc[onBulletLeave];
		}
	}

	///<summary>
	///aoe创建时的事件
	///<param name="aoe">被创建出来的aoe的gameObject</param>
	///</summary>
	public delegate void AoeOnCreate(LogicAoe aoe);

	///<summary>
	///aoe移除时候的事件
	///<param name="aoe">被创建出来的aoe的gameObject</param>
	///</summary>
	public delegate void AoeOnRemoved(LogicAoe aoe);

	///<summary>
	///aoe每一跳的事件
	///<param name="aoe">被创建出来的aoe的gameObject</param>
	///</summary>
	public delegate void AoeOnTick(LogicAoe aoe);

	///<summary>
	///当有角色进入aoe范围的时候触发
	///<param name="aoe">被创建出来的aoe的gameObject</param>
	///<param name="actorList">进入aoe范围的那些角色，他们现在还不在aoeState的角色列表里</param>
	///</summary>
	public delegate void AoeOnCharacterEnter(LogicAoe aoe, List<LogicActor> actorList);

	///<summary>
	///当有角色离开aoe范围的时候
	///<param name="aoe">离开aoe的gameObject</param>
	///<param name="actorList">离开aoe范围的那些角色，他们现在已经不在aoeState的角色列表里</param>
	///</summary>
	public delegate void AoeOnCharacterLeave(LogicAoe aoe, List<LogicActor> actorList);

	///<summary>
	///当有子弹进入aoe范围的时候
	///<param name="aoe">被创建出来的aoe的gameObject</param>
	///<param name="bulletList">离开aoe范围的那些子弹，他们现在已经不在aoeState的子弹列表里</param>
	///</summary>
	public delegate void AoeOnBulletEnter(LogicAoe aoe, List<LogicBullet> bulletList);

	///<summary>
	///当有子弹离开aoe范围的时候
	///<param name="aoe">离开的aoe的gameObject</param>
	///<param name="bulletList">离开aoe范围的那些子弹，他们现在已经不在aoeState的子弹列表里</param>
	///</summary>
	public delegate void AoeOnBulletLeave(LogicAoe aoe, List<LogicBullet> bulletList);
}